package models;

import java.util.*;
import javax.persistence.*;

import play.data.format.*;
import play.data.validation.*;

public class HouseForm {

	@Constraints.Required
	public Integer house;

	public String seats;

	@Constraints.Required
	@Formats.NonEmpty
	public String language;




	public String validate() {
		String seat[] = seats.split(":");
		String blockedSeats = "";

		for(String s : seat){
			if(Payment.isPaymentForSeatExists(house,s))
				blockedSeats	+= ( s + " ");
		}

		if(blockedSeats != "")
			return ("There exists payment for seats: " + blockedSeats + ". No modification can be done.");



		return null;
	}


}

